﻿<UserControl x:Class="Workbench.Presentation.ApplicationMenuView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:ui="clr-namespace:Workbench.Presentation" 
             mc:Ignorable="d" 
             d:DesignHeight="20" d:DesignWidth="300" DataContextChanged="ApplicationMenu_DataContextChanged">
    <UserControl.Resources>
        <ui:BooleanAndConverter x:Key="andConverter" />
    </UserControl.Resources>
    <Menu IsMainMenu="True">
        <MenuItem Header="_File">
            <MenuItem Header="_New Project" Click="NewProject_Click"></MenuItem>
            <MenuItem Header="_Open Project" Click="OpenProject_Click"></MenuItem>
            <MenuItem Header="_Close Project" Click="CloseProject_Click" IsEnabled="{Binding CanCloseProject}"></MenuItem>
            <Separator></Separator>
            <MenuItem Header="Recenty Projects" ItemsSource="{Binding RecentlyUsedProjects}" Click="RecentProject_Click">
                <MenuItem.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding}" />
                    </DataTemplate>
                </MenuItem.ItemTemplate>
            </MenuItem>
            <Separator></Separator>
            <!--<MenuItem Header="_Open Debug Project" Click="OpenDebugProject_Click"></MenuItem>
            <MenuItem Header="_Recreate Debug Project" Click="RecreateDebugProject_Click"></MenuItem>-->
            <MenuItem Header="E_xit" Click="Exit_Click"></MenuItem>
        </MenuItem>
        <MenuItem Header="POS Sets">
            <MenuItem Header="Add new set"></MenuItem>
            <MenuItem Header="Use existing set" ItemsSource="{Binding AvailablePOSTypeSets}" Click="DeployPOSTypes_Click"></MenuItem>
            <MenuItem.IsEnabled>
                <MultiBinding Converter="{StaticResource andConverter}">
                    <Binding Path="CanCloseProject"></Binding>
                    <Binding Path="HasAvailablePOSTypeSets"></Binding>
                </MultiBinding>
            </MenuItem.IsEnabled>
            <MenuItem.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding}"></TextBlock>
                </DataTemplate>
            </MenuItem.ItemTemplate>
        </MenuItem>
        <MenuItem Header="_Help">
            <MenuItem Header="_About"></MenuItem>
        </MenuItem>
    </Menu>
</UserControl>
